<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="root">
        <div v-box></div>
    </div>
</body>
<script>
    Vue.config.productionTip = false
    let vm = new Vue({
        el: "#root",
        directives: {
            box(element) {
                element.style.border = "1px solid #000"
                element.style.height = "150px"
                element.style.width = "300px"

                var input = document.createElement("input")
                input.style.background = "yellowgreen"
                input.autofocus = true
                input.style.height = "40px"

                element.appendChild(input)
            }
        }
    })
    //     var box = document.querySelector(".box")
    //     var input = document.createElement("input")
    //     input.placeholder ="请输入"
    //     input.autofocus = true
    //     input.style.background = "yellowgreen"
    //     input.style.height = "40px"
    //     box.appendChild(input)
    // 
</script>

</html>